package impl.UserServiceImpl;

import com.dao.UserDao;
import com.hbnu.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service("userService")
public class UserServiceImpl implements UserService {
    //注入list
//    private List<String> stringList;
//    public void setStringList(List<String> stringList) {
//        this.stringList = stringList;
//    }
//
//    public void show(){
//        System.out.println(stringList);
//    }
    @Autowired //根据类型注入
    @Qualifier("userDao2")
    @Resource(name = "userDao2")
    private UserDao userDao;
    public void  show(){
        System.out.println(userDao);
    }



//@Autowired
//    public void setUserDao(UserDao userDao) {
//        this.userDao = userDao;
//    }


//    public UserServiceImpl(){
//        System.out.println("无参");
//    }
//    public UserServiceImpl(String name){
//        System.out.println("有参");
//    }
//    public  void  setUserDao(UserDao userDao){
//        System.out.println(userDao);
//        this.userDao = userDao;
//    }

    public void show1() {
        System.out.println("show1");
    }

    public void show2() {
        System.out.println("show2");
//        int i = 1/0;
    }
}
